home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / linux-boot-probes / mounted / 90fallback < prev   
Text File  |  2004-07-11  |  1KB  |  43 lines

  1. #!/bin/sh
  2. # Fallback in case nothing else works. Look for vmlinu[xz] file in root and
  3. # /boot, see if there is a matching initrd, and wing it.
  4. . /usr/share/os-prober/common.sh
  5. set -e
  6.  
  7. partition="$1"
  8. bootpart="$2"
  9. mpoint="$3"
  10. type="$4"
  11.  
  12. mappedpartition=$(mapdevfs "$partition" 2>/dev/null) || mappedpartition="$partition"
  13.  
  14. exitcode=1
  15. for kernpat in /vmlinuz /vmlinux /boot/vmlinuz /boot/vmlinux "/boot/vmlinuz*" \
  16.             "/boot/vmlinux*" "/vmlinuz*" "/vmlinux*"; do
  17.     if echo "$kernpat" | grep -q boot/; then
  18.         kernbootpart=$bootpart
  19.     else
  20.         kernbootpart=$partition
  21.     fi
  22.     for kernfile in $(eval ls $mpoint$kernpat 2>/dev/null); do
  23.         kernbasefile=$(echo "$kernfile" | sed "s!^$mpoint!!")
  24.         if [ -f "$kernfile" ] && [ ! -L "$kernfile" ]; then
  25.             initrdname=$(echo "$kernfile" | sed "s/vmlinu[zx]/initrd\*/")
  26.             foundinitrd=0
  27.             for initrd in $(eval ls $initrdname 2>/dev/null); do
  28.                 if [ -f "$initrd" ] && [ ! -L "$initrd" ]; then
  29.                     initrd=$(echo "$initrd" | sed "s!^$mpoint!!")
  30.                     result "$partition:$kernbootpart::$kernbasefile:$initrd:root=$mappedpartition"
  31.                     exitcode=0
  32.                     foundinitrd=1
  33.                 fi
  34.             done
  35.             if [ "$foundinitrd" = 0 ]; then
  36.                 result "$partition:$kernbootpart::$kernbasefile::root=$mappedpartition"
  37.                 exitcode=0
  38.             fi
  39.         fi
  40.     done
  41. done
  42. exit $exitcode
  43.